package cn.com.dingtek.genius.manager.server.support;

import lombok.Getter;
import lombok.ToString;

import java.util.Arrays;
import java.util.Optional;

@Getter
@ToString
public enum PlatformType {
    /**
     *
     */
    CHINA_TELECOM(1, "电信平台"),
    HUA_WEI(2, "华为平台"),
    CHINA_MOBILE(3, "移动平台");

    private int value;
    private String desc;

    PlatformType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static Optional<PlatformType> valueOf(Integer value) {
        return Arrays.stream(PlatformType.values())
                .filter(item -> item.getValue() == value)
                .findFirst();
    }

    @Override
    public String toString() {
        return desc;
    }
}
